import type { RouteRecordRaw } from 'vue-router'

export const allRouters: Readonly<RouteRecordRaw[]> = [
  {
    path: '/user-manage',
    name: 'user_manage',
    component: () => import('@/views/UserManage/index.vue'),
    meta: {
      desc: '用户管理'
    }
  },
  {
    path: '/role-manage',
    name: 'role_manage',
    component: () => import('@/views/RoleManage/index.vue'),
    meta: {
      desc: '角色管理'
    }
  },
  {
    path: '/permission-manage',
    name: 'permission_manage',
    component: () => import('@/views/PermissionManage/index.vue'),
    meta: {
      desc: '权限管理'
    }
  },
  {
    path: '/talent',
    name: 'talent',
    component: () => import('@/views/Talent/index.vue'),
    meta: {
      desc: '简历管理'
    }
  },
  {
    path: '/:pathMatch(.*)*',
    redirect: '/404'
  }
]

export const pathRouteMap: Record<string, RouteRecordRaw> = {}
allRouters.forEach((route) => {
  const { path, redirect } = route
  if (redirect === '/404') {
    pathRouteMap['/404'] = route
  } else {
    pathRouteMap[path] = route
  }
})
